//package com.yksj.healthtalk.ui.doctorstation;
//
//import org.json.JSONObject;
//
//import android.content.BroadcastReceiver;
//import android.content.Context;
//import android.content.Intent;
//import android.content.IntentFilter;
//import android.os.Bundle;
//import android.support.v4.app.Fragment;
//import android.support.v4.view.ViewPager;
//import android.view.LayoutInflater;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.view.ViewGroup;
//import android.widget.TextView;
//
//import com.yksj.healthtalk.comm.InstructionsDialogFragment;
//import com.yksj.healthtalk.comm.RootFragment;
//import com.yksj.healthtalk.net.http.AsyncHttpResponseHandler;
//import com.yksj.healthtalk.net.http.HttpRestClient;
//import com.yksj.healthtalk.net.socket.SmartFoxClient;
//import com.yksj.healthtalk.services.MessagePushService;
//import com.yksj.healthtalk.ui.FragmentContentActivity;
//import com.yksj.healthtalk.ui.R;
//import com.yksj.healthtalk.ui.buyandsell.BuyAndSellMainActivity;
//import com.yksj.healthtalk.ui.doctorstation.service.DoctorQuerySubscribeServiceActivity;
//import com.yksj.healthtalk.ui.friend.DoctorInfoUIActivity;
//import com.yksj.healthtalk.ui.friend.DoctorMainActivity;
//import com.yksj.healthtalk.ui.home.HelperListActivity;
//import com.yksj.healthtalk.ui.messageleave.DoctorMessageBoardDoctor;
//import com.yksj.healthtalk.ui.salon.SalonAboutOthersActivity;
//
///**
// * 
// * 一个界面(废弃)
// * @author zhao
// *
// */
//public class DoctorStationFirstPageFragment extends Fragment implements OnClickListener {
//	
//	TextView messageCountTextV;
//	View leftView;
//	View rightView;
//	private long lastClickTime; 
//	private TextView registerTextCount;//患者名单消息数量
//	private TextView mPatientCount,mSalonMsgCount;//挂号名单消息数量 专业话题
//	ViewPager mViewPager;
//	RootFragment mRootFragment;
//	
//	BroadcastReceiver mReceiver = new BroadcastReceiver(){
//		@Override
//		public void onReceive(Context context, Intent intent) {
//			String action = intent.getAction();
//			if (action.equals(MessagePushService.ACTION_MESSAGE)) {
//				queryDataCount();
//			}
//		}
//	};
//	
//	public void setViewPager(ViewPager mViewPager) {
//		this.mViewPager = mViewPager;
//	}
//	
//	public void setRootFragment(RootFragment fragment){
//		mRootFragment  = fragment;
//	}
//	
//	
//	@Override
//	public void onCreate(Bundle savedInstanceState) {
//		super.onCreate(savedInstanceState);
//		InstructionsDialogFragment.show(6,getFragmentManager());
//	}
//	
//	@Override
//	public View onCreateView(LayoutInflater inflater, ViewGroup container,
//			Bundle savedInstanceState) {
//				return container;
////		View view = inflater.inflate(R.layout.doctor_station_first_layout,null);
////		leftView = view.findViewById(R.id.left_img);
////		rightView = view.findViewById(R.id.right_img);
////		rightView.setOnClickListener(this);
////		leftView.setOnClickListener(this);
////		
////		messageCountTextV = (TextView)view.findViewById(R.id.textView1);
////		messageCountTextV.setOnClickListener(this);//面板
////		view.findViewById(R.id.imageView1).setOnClickListener(this);//患者名单
////		view.findViewById(R.id.register_list_btn).setOnClickListener(this);//挂号名单
////		view.findViewById(R.id.imageView3).setOnClickListener(this);//医生资料
////		view.findViewById(R.id.salon).setOnClickListener(this);//话题
////		view.findViewById(R.id.calendar).setOnClickListener(this);//经营
////		view.findViewById(R.id.header_imgv).setOnClickListener(this);//服务
////		view.findViewById(R.id.imageView2).setOnClickListener(this);//主页
////		view.findViewById(R.id.imageView7).setOnClickListener(this);//医生指南
////		view.findViewById(R.id.station_next_page).setOnClickListener(this);//下一页
////		
////		registerTextCount= (TextView) view.findViewById(R.id.imageView_icon_count);
////		mPatientCount= (TextView) view.findViewById(R.id.doctor_msg_count);
////		mSalonMsgCount= (TextView) view.findViewById(R.id.salon_msg_count);
////		
////		return view;
//	}
//	
//	@Override
//	public void onActivityCreated(Bundle savedInstanceState) {
//		super.onActivityCreated(savedInstanceState);
////		CustomerInfoEntity entity = SmartFoxClient.getLoginUserInfo();
//	/*	if(entity.getName() == null || "".equals(entity.getName())){
//			nameTextV.setText(entity.getUsername());
//		}else{
//			nameTextV.setText(entity.getName());
//		}*/
//	}
//	
//	@Override
//	public void onStart() {
//		IntentFilter filter = new IntentFilter();
//		filter.addAction(MessagePushService.ACTION_MESSAGE);
//		getActivity().registerReceiver(mReceiver, filter);
//		super.onStart();
//		/*boolean isShow = SharePreUtils.fatchLockState();
//		if(isShow){
//			leftView.setVisibility(View.VISIBLE);
//			rightView.setVisibility(View.VISIBLE);
//		}else{
//			leftView.setVisibility(View.INVISIBLE);
//			rightView.setVisibility(View.INVISIBLE);
//		}*/
//	}
//	
//	@Override
//	public void onStop() {
//		getActivity().unregisterReceiver(mReceiver);
//		super.onStop();
//	}
//	
//	@Override
////	public void onClick(View v) {
////		Intent intent;
////		switch(v.getId()){
////		case R.id.left_img:
////			mRootFragment.onBackPressed(v);
////			/*{
////			intent = new Intent(getActivity(),FragmentContentActivity.class);
////			intent.putExtra("type",1);
////			startActivity(intent);
////			}*/
////			break;
////		case R.id.right_img:{
////			intent = new Intent(getActivity(),FragmentContentActivity.class);
////			intent.putExtra("type",0);
////			startActivity(intent);
////			}
////			break;
////		case R.id.imageView1://患者
////			/*intent = new Intent(getActivity(),DoctorStationFriendListActivity.class);
////			startActivity(intent);*/
////			intent = new Intent(getActivity(),PatientServiceMainFragmentList.class);
////			startActivity(intent);
////			break;
////		case R.id.header_imgv://医生设置
////			intent = new Intent(getActivity(),DoctorSettingActivity.class);
////			startActivity(intent);
////			break;
////		case R.id.textView1://个人资料
////			/*intent = new Intent(getActivity(),PersonalInformationActivity.class);
////			startActivityForResult(intent,2);*/
////			intent = new Intent(getActivity(),DoctorMessageBoardDoctor.class);
////			startActivity(intent);
////			break;
////		case R.id.salon://创建的专业话题(医生话题)
////			/*intent = new Intent(getActivity(),DoctorStationGroupListActivity.class);
////			startActivity(intent);*/
////			intent =new Intent(getActivity(),SalonAboutOthersActivity.class);
////			intent.putExtra("type", "0");
////			startActivity(intent);
////			break;
////		case R.id.imageView2://返回主场景
////			//onBackPressed(v);
////			break;
////		case R.id.calendar:
////			intent = new Intent(getActivity(),DoctorQuerySubscribeServiceActivity.class);
////			startActivity(intent);
////			break;
////		case R.id.register_list_btn://挂号列表
////			intent = new Intent(getActivity(),DoctorSettingClient.class);
////			startActivity(intent);
////			break;
////		case R.id.imageView3://医生认证
////			//if(!isFastDoubleClick())
////			//showCalenderDialog();
////			intent = new Intent(getActivity(),DoctorInfoUIActivity.class);
////			intent.putExtra("id",SmartFoxClient.getLoginUserId());
////			startActivity(intent);
////			break;
////		case R.id.imageView7://小助手
////			intent = new Intent(getActivity(),HelperListActivity.class);
////			startActivity(intent);
////			getActivity().overridePendingTransition(R.anim.anim_enter, R.anim.anim_exit);
////			/*
////			intent = new Intent(getActivity(),SettingWebUIActivity.class);//www.baidu.com
////			intent.putExtra("url", "http://second-vision.mobi/JumpPage/JumpPageServlet?Type=DoctorHelp");
////			intent.putExtra("title", "医生指南");
////			startActivity(intent);*/
////			break;
////		case R.id.station_next_page://下一页
////			if(mViewPager != null){
////				int index = mViewPager.getCurrentItem();
////				mViewPager.setCurrentItem(++index,true);
////			}
////			break;
////		}
////	}
//
////	 public boolean isFastDoubleClick() {
////	        long time = System.currentTimeMillis();
////	        long timeD = time - lastClickTime;
////	        if ( 0 < timeD && timeD < 1000) {   
////	            return true;   
////	        }   
////	        lastClickTime = time;   
////	        return false;   
////	    }
//	 
////	private void showCalenderDialog(){
//////		CaldroidFragment dialogCaldroidFragment= new CaldroidFragment();
//////		dialogCaldroidFragment.show(getFragmentManager(),"CALDROID_DIALOG_FRAGMENT");
//////		dialogCaldroidFragment.setCancelable(true);
////	}
//	
//	@Override
//	public void onResume() {
//		super.onResume();
//		queryDataCount();
//	}
//	
//	private void queryDataCount(){
//		HttpRestClient.doHttpMyZoneCount("50,60,70",SmartFoxClient.getLoginUserId(),"0",new AsyncHttpResponseHandler(){
//			@Override
//			public void onSuccess(int statusCode, String content) {
//				super.onSuccess(statusCode, content);
//				//{"20":"1","10":"0","30":"8","40":"0","90":"9","70":"0","80":"0","60":"0","100":"0","50":"0"}
//				try {
//					JSONObject result=new JSONObject(content);
//					meSageCount(mPatientCount,result.optInt("60",0)); //0 助理未读消息
//					meSageCount(registerTextCount,result.optInt("70",0));//1 医生未读消息
//					meSageCount(mSalonMsgCount,result.optInt("50",0));//1 医生未读消息
//				} catch (Exception e) {
//				}
//			}
//		});
//		//获取公告板未读条数
//		HttpRestClient.doHttpMessageLeaveCount(new AsyncHttpResponseHandler(){
//			@Override
//			public void onSuccess(String content) {
//				super.onSuccess(content);
//				try {
//					int count=Integer.valueOf(content);
//					if(count>0){
//						messageCountTextV.setText("您有"+content+"条未读留言。");
//					}else{
//						messageCountTextV.setText("公告板");
//					}
//				} catch (Exception e) {
//				}
//			}
//		});
//	}
//	
//	private void meSageCount(TextView id,int count){
//		if(count!=0){
//			id.setText(count+"");
//			id.setVisibility(View.VISIBLE);
//		}else{
//			id.setVisibility(View.GONE);
//		}
//	}
//}
